#ifndef __display_h
#define __display_h



#define  bit1           0x01
#define  bit2           0x02
#define  bit3           0x04
#define  bit4           0x08
#define  bit5           0x10
#define  bit6           0x20
#define  bit7           0x40
#define  bit8           0x80


#define curTempBuff1 		displayBuffer[0]
#define  curTempBuff2 		displayBuffer[1]
#define  curTempBuff3 		displayBuffer[2]
#define  curTempBuff4 		displayBuffer[3]
#define setTempBuff1  		displayBuffer[4]
#define  setTempBuff2  		displayBuffer[5]
#define gearBuff			displayBuffer[6]
#define clockBuff1				displayBuffer[7]
#define  clockBuff2				displayBuffer[8]
#define clockBuff3       		displayBuffer[9]
#define clockBuff4       		displayBuffer[10]

#define  set_led_1a  curTempBuff1|=bit1
#define  set_led_1b  curTempBuff1|=bit2
#define  set_led_1c  curTempBuff1|=bit3
#define  set_led_1d  curTempBuff1|=bit4
#define  set_led_1e  curTempBuff1|=bit5
#define  set_led_1f  curTempBuff1|=bit6
#define  set_led_1g  curTempBuff1|=bit7
#define clr_led_curTemp1     curTempBuff1&=bit8

#define  set_led_2a  curTempBuff2|=bit1
#define  set_led_2b  curTempBuff2|=bit2
#define  set_led_2c  curTempBuff2|=bit3
#define  set_led_2d  curTempBuff2|=bit4
#define  set_led_2e  curTempBuff2|=bit5
#define  set_led_2f  curTempBuff2|=bit6
#define  set_led_2g  curTempBuff2|=bit7
#define clr_led_curTemp2    curTempBuff2&=bit8

#define  set_led_3a  curTempBuff3|=bit1
#define  set_led_3b  curTempBuff3|=bit2
#define  set_led_3c  curTempBuff3|=bit3
#define  set_led_3d  curTempBuff3|=bit4
#define  set_led_3e  curTempBuff3|=bit5
#define  set_led_3f  curTempBuff3|=bit6
#define  set_led_3g  curTempBuff3|=bit7
#define clr_led_curTemp3     curTempBuff3&=bit8

#define  set_led_4a  curTempBuff4|=bit1
#define  set_led_4b  curTempBuff4|=bit2
#define  set_led_4c  curTempBuff4|=bit3
#define  set_led_4d  curTempBuff4|=bit4
#define  set_led_4e  curTempBuff4|=bit5
#define  set_led_4f  curTempBuff4|=bit6
#define  set_led_4g  curTempBuff4|=bit7
#define clr_led_curTemp4     curTempBuff4&=bit8

#define  set_led_5a  setTempBuff1|=bit1
#define  set_led_5b  setTempBuff1|=bit2
#define  set_led_5c  setTempBuff1|=bit3
#define  set_led_5d  setTempBuff1|=bit4
#define  set_led_5e  setTempBuff1|=bit5
#define  set_led_5f  setTempBuff1|=bit6
#define  set_led_5g  setTempBuff1|=bit7
#define clr_led_setTempBuff1     setTempBuff1&=bit8

#define  set_led_6a  setTempBuff2|=bit1
#define  set_led_6b  setTempBuff2|=bit2
#define  set_led_6c  setTempBuff2|=bit3
#define  set_led_6d  setTempBuff2|=bit4
#define  set_led_6e  setTempBuff2|=bit5
#define  set_led_6f  setTempBuff2|=bit6
#define  set_led_6g  setTempBuff2|=bit7
#define clr_led_setTempBuff2     setTempBuff2&=bit8

#define  set_led_7a  gearBuff|=bit1
#define  set_led_7b  gearBuff|=bit2
#define  set_led_7c  gearBuff|=bit3
#define  set_led_7d  gearBuff|=bit4
#define  set_led_7e  gearBuff|=bit5
#define  set_led_7f  gearBuff|=bit6
#define  set_led_7g  gearBuff|=bit7
#define clr_led_gearBuff     gearBuff&=bit8

#define  set_led_8a  clockBuff1|=bit1
#define  set_led_8b  clockBuff1|=bit2
#define  set_led_8c  clockBuff1|=bit3
#define  set_led_8d  clockBuff1|=bit4
#define  set_led_8e  clockBuff1|=bit5
#define  set_led_8f  clockBuff1|=bit6
#define  set_led_8g  clockBuff1|=bit7
#define clr_led_clockBuff1     clockBuff1&=bit8

#define  set_led_9a  clockBuff2|=bit1
#define  set_led_9b  clockBuff2|=bit2
#define  set_led_9c  clockBuff2|=bit3
#define  set_led_9d  clockBuff2|=bit4
#define  set_led_9e  clockBuff2|=bit5
#define  set_led_9f  clockBuff2|=bit6
#define  set_led_9g  clockBuff2|=bit7
#define clr_led_clockBuff2     clockBuff2&=bit8

#define  set_led_10a  clockBuff3|=bit1
#define  set_led_10b  clockBuff3|=bit2
#define  set_led_10c  clockBuff3|=bit3
#define  set_led_10d  clockBuff3|=bit4
#define  set_led_10e  clockBuff3|=bit5
#define  set_led_10f   clockBuff3|=bit6
#define  set_led_10g  clockBuff3|=bit7
#define clr_led_clockBuff3     clockBuff3&=bit8

#define  set_led_11a  clockBuff4|=bit1
#define  set_led_11b  clockBuff4|=bit2
#define  set_led_11c  clockBuff4|=bit3
#define  set_led_11d  clockBuff4|=bit4
#define  set_led_11e  clockBuff4|=bit5
#define  set_led_11f   clockBuff4|=bit6
#define  set_led_11g  clockBuff4|=bit7
#define clr_led_clockBuff4     clockBuff4&=bit8

#define  orderOpenOn  		curTempBuff1=curTempBuff1|b1000_0000;
#define  orderOpenOff 		curTempBuff1=curTempBuff1 &b0111_1111;


#define  orderCloseOn  	curTempBuff2=	curTempBuff2 |b1000_0000
#define  orderCloseOff  curTempBuff2=	curTempBuff2 &b0111_1111;


#define  curTempFlagOn  	curTempBuff3=curTempBuff3 |b1000_0000
//#define  curTempFlagOff 	curTempBuff3 &b0111_1111;


#define  errorOn			curTempBuff4=curTempBuff4 |b1000_0000
#define  errorOff       	curTempBuff4=curTempBuff4 &b0111_1111;


#define setTempChar1On		setTempBuff1=setTempBuff1  |b1000_0000
#define setTempChar1Off    	setTempBuff1=setTempBuff1   &b0111_1111;


#define  setTempFlagOn		setTempBuff2=setTempBuff2    |b1000_0000
#define  setTempFlagOff    setTempBuff2= setTempBuff2      &b0111_1111;


#define gearCharOn			gearBuff=gearBuff     |b1000_0000
#define gearCharOff         gearBuff=gearBuff      &b0111_1111;

#define setTempChar2On		clockBuff1=clockBuff1	|b1000_0000
#define setTempChar2Off  	clockBuff1=clockBuff1	 &b0111_1111;



#define clockFlagOn			clockBuff2=clockBuff2		|b1000_0000
#define clockFlagOff	     clockBuff2=clockBuff2  &b0111_1111







#define clockCharOn			clockBuff4=clockBuff4	|b1000_0000
#define clockCharOff       clockBuff4=clockBuff4  &b0111_1111;

#define saveTempCharOn      displayBuffer[11]= displayBuffer[11]|b0000_0001
#define saveTempCharOff    displayBuffer[11]= displayBuffer[11] &b1111_1110

#define  heatCharOn		      displayBuffer[11]=  displayBuffer[11]|b0000_0010
#define  heatCharOff		 displayBuffer[11]=  displayBuffer[11] &b1111_1101

#define  ZaoShangCharOn  	 displayBuffer[11]=   displayBuffer[11]|b0000_0100
#define  ZaoShangCharOff		 displayBuffer[11]=  displayBuffer[11] &b1111_1011

#define lowWorkCharOn		 displayBuffer[11]=  displayBuffer[11]|b0000_1000
#define lowWorkCharOff  	 displayBuffer[11]= 	displayBuffer[11] &b1111_0111

#define XiaWuCharOn		 displayBuffer[11]= displayBuffer[11]|b0001_0000
#define XiaWuCharOff		 displayBuffer[11]= displayBuffer[11] &b1110_1111

#define highWorkCharOn			 displayBuffer[11]=  displayBuffer[11]|b0010_0000
#define highWorkCharOff  	 displayBuffer[11]= displayBuffer[11] &b1101_1111

#define WanShangCharOn		 displayBuffer[11]=  displayBuffer[11]|b0100_0000
#define WanShangCharOff     displayBuffer[11]=  displayBuffer[11] &b1011_1111



#define 	killWorkCharOn	 displayBuffer[11]=  displayBuffer[11]|b1000_0000
#define   killWorkCharOff	 displayBuffer[11]= displayBuffer[11] &b0111_1111

#define redLedOn		displayBuffer[12]=displayBuffer[12]=0xff ;displayBuffer[13]=displayBuffer[13]=0xff
#define redLedOff		displayBuffer[12]=	displayBuffer[12]=0x00 ;displayBuffer[13]=displayBuffer[13]=0x00

#define blueLedOn			displayBuffer[14]=displayBuffer[14]=0xff ;displayBuffer[15]=displayBuffer[15]=0xff
#define blueLedOff			displayBuffer[14]=displayBuffer[14]=0x00 ;displayBuffer[15]=displayBuffer[15]=0x00
#ifdef __display_c

uint8_t    displayBuffer[16] ;

uint8_t    bdata    d_seg;
sbit    f_seg_a=d_seg^0;
sbit    f_seg_b=d_seg^1;
sbit    f_seg_c=d_seg^2;
sbit    f_seg_d=d_seg^3;
sbit    f_seg_e=d_seg^4;
sbit    f_seg_f=d_seg^5;
sbit    f_seg_g=d_seg^6;
sbit    f_seg_h=d_seg^7;


uint8_t  data  clockHour;
uint8_t  data  clockMin;
code const uint8_t displayFonts[10];
#else
extern code const uint8_t displayFonts[10];
extern uint8_t data   clockHour;
extern uint8_t data  clockMin;
extern uint8_t displayBuffer[16] ;

extern uint8_t    bdata    d_seg;

#endif

void		DisplayScan();
void DengDai();
#endif
